const mongoose = require('mongoose');

const OrderSchema = mongoose.Schema({
    _id: mongoose.Schema.Types.ObjectId,
    name: { type: String, required: true },
    phone: { type: Number, required: true },
    address: { type: String, required: true },
    quantity: { type: Number, required: true, default: 1 },
    product: { type: mongoose.Schema.Types.ObjectId, ref: 'Product', required: true }
    //product: { type: Array, required: true },关联查询ref为另一张表名
})

module.exports = mongoose.model("Order", OrderSchema);